@extends('admin.layout')

@section('content')
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                <li><a href="#">会员管理</a></li>
                <li><a href="#">显示批次会员</a></li>
                <li class="active"> 批次会员列表</li>
            </ol>
        </section>
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12" style="width: 100%;">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title"></h3>
                        </div>
                        <span id="msg" style="display: none">
                            @if (count($errors) > 0)
                                @foreach ($errors->all() as $error)
                                    <div style="width: 100%;">
                                        <span style="color: red;display: block;margin: 0px auto;width: 200px;text-align: center;">{{ $error }}</span>
                                    </div>
                                @endforeach
                            @else
                                <div style="width: 100%;">
                                    <span style="color: green;display: block;margin: 0px auto;width: 200px;text-align: center;">{{ Session::get('msg') }}</span>
                                </div>
                            @endif
                        </span>
                        <script type="text/javascript">
                            var _msg = $('#msg div span').text();
                            console.log(_msg);
                            if(_msg != ''){
                                layer.msg(_msg);
                            }
                        </script>
                        <div class="box-body" style="overflow: auto;">
                            <form action="{{ url('admin/audits') }}" method="post" >
                                {{ csrf_field() }}
                                <table class="table table-striped table-hover text-center">
                                    <tr>
                                        <th style="width: 50px; text-align:center;min-width: 75px;">编号</th>
                                        <th style="width: 50px; text-align:center;min-width: 75px;">创建时间</th>
                                        <th style="width: 50px; text-align:center;min-width: 75px;">名称</th>
                                        <th style="width: 50px; text-align:center;min-width: 75px;">积分</th>
                                        <th style="width: 50px; text-align:center;min-width: 75px;">电话</th>
                                        <th style="width: 50px; text-align:center;min-width: 75px;">邮箱</th>
                                        <th style="width: 50px; text-align:center;min-width: 75px;">性别</th>
                                        <th style="width: 50px; text-align:center;min-width: 75px;">生日</th>
                                        <th style="width: 50px; text-align:center;min-width: 75px;">车牌号</th>
                                        <th style="width: 50px; text-align:center;min-width: 75px;">身份证号</th>
                                        <th style="width: 50px; text-align:center;min-width: 75px;">客户经理</th>
                                        <th style="width: 50px; text-align:center;min-width: 75px;">批次号</th>
                                        <th style="width: 50px; text-align:center;min-width: 75px;">状态</th>
                                        <th style="width: 130px; text-align:center;min-width: 220px">操作</th>
                                    </tr>
                                    @foreach($list as $value)
                                        <tr>
                                            <td>{{ $value['id'] }}</td>
                                            <td>{{ $value['create_time']}}</td>
                                            <td>{{ $value['name']}}</td>
                                            <td>{{ $value['integral'] }}</td>
                                            <td>{{ $value['phone']}}</td>
                                            <td>{{ $value['email']}}</td>
                                            {{--<td>{{ $value['sex'] }}</td>--}}
                                            <td>
                                                {{ $value['sex'] }}
                                            </td>
                                            <td>{{ $value['birth']}}</td>
                                            <td>{{ $value['car_num']}}</td>
                                            <td>{{ $value['user_num']}}</td>
                                            {{--<td>{{ $value['mid']}}</td>--}}
                                            <td>
                                                {{ App\Manage::find($value['mid'])['username'] }}
                                            </td>
                                            <td>{{ $value['u_batch']}}</td>
                                            <td>
                                                @if($value['status'] ==1)已启用
                                                @else未启用
                                                @endif
                                            </td>
                                            <td>
                                                {{--<a class="btn btn-success btn-xs"   href="{{ url('admin/users/CollectionList/'.$value['id']) }}">收藏列表<a>--}}
                                                <a class="btn btn-success btn-xs"   href="{{ url('admin/users/integralList/'.$value['id']) }}">积分管理<a>
                                                <a class="btn btn-success btn-xs"  href="{{ url('admin/users/setStatus/'.$value['id'].'/1' )}}" >启用<a>
                                                <a class="btn btn-warning btn-xs"  href="{{ url('admin/users/setStatus/'.$value['id'].'/0') }}" >禁用<a>
                                                <a class="btn btn-info btn-xs"  href="{{ url('admin/users/getUser/'.$value['id']) }}" >修改<a>
                                            </td>
                                        </tr>

                                    @endforeach
                                    {{--<tr><td></td></tr>--}}
                                    <tr id="display" style="display: none;">
                                        <td colspan="2">会员名称:<br /><input type="text" id="user_name" name="user_name" value=""></td>
                                        <td colspan="2">车牌号:<br /><input type="text" id="car_num" name="car_num" value=""></td>
                                        <td colspan="3">手机号:<br /><input type="text" id="phone" name="phone" value=""></td>
                                        <td colspan="2">积分:<br /><input type="text" id="integ" name="integ" value="" size="15px"></td>
                                        <td colspan="4">详细地址:<br /><input type="text" id="address" name="address" value="" size="50px"></td>
                                        <input type="hidden" id="batch" value="{{ $batch }}">
                                        <td colspan="1"><a class="btn btn-success btn-sm" onclick="user()">添加<a></td>
                                    </tr>
                                </table>
                                {{--<input type="checkbox" id="checkAll" > 全选--}}
                                <script>
//                                    $("#checkAll").click(function () {
//                                        if (this.checked) {
//                                            $(this).attr("checked", "checked");
//                                            $("input[name='id[]']").each(function () {
//                                                this.checked = true;
//                                            });
//                                        } else {
//                                            $(this).removeAttr("checked");
//                                            $("input[name='id[]']").each(function () {
//                                                this.checked = false;
//                                            });
//                                        }
//                                    });
                                    function display() {
                                        document.getElementById('display').style.display = ""
                                    }
                                </script>
                                {{--<input type="submit" class="btn btn-warning btn-sm" value="批量兑换"/>--}}
                                {{--<a href="{{ url('admin/passAudit/'.$batch)}}" class="btn btn-warning btn-sm">全部审核</a>--}}
                                <input type="button" onclick="display()" class="btn btn-warning btn-sm" value="添加会员">
                                <a href="{{ url('admin/out/'.$batch) }}" class="btn btn-warning btn-sm" >导出名单</a>
                                {{--<input type="button" onclick="display()" class="btn btn-warning btn-sm" value="添加订单">--}}
                            </form>
                        </div>
                        {{--@foreach($list as $l=>$value)--}}
                        {{--{{ $value['batch'] }}--}}
                        {{--@endforeach--}}
                    </div>
                </div>
            </div>
        </section>
    </div>
@stop